package com.geek.bucks.repository

import com.geek.bucks.entity.Coffee
import com.geek.bucks.entity.CoffeeOrder
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.repository.NoRepositoryBean
import org.springframework.stereotype.Repository

@NoRepositoryBean
interface BaseRepository<T, Long> : JpaRepository<T, Long> {
    fun findTop3ByOrderByUpdateTimeDescIdAsc(): List<T>
}

@Repository
interface CoffeeRepository : BaseRepository<Coffee, Long> {
    fun findByNameInOrderById(names: List<String>): List<Coffee>

    fun findByName(name: String): List<Coffee>?
}

@Repository
interface CoffeeOrderRepository : BaseRepository<CoffeeOrder, Long> {
    fun findByCustomerOrderById(customer: String): List<CoffeeOrder>

    fun findByItems_Name(name: String): List<CoffeeOrder>

}
